
/*
Find and opend "opencv/cxcore/include/cxtypes.h", Read through and find the many conversion helper functions.
a. Choose a negative floating-point number.
b. Take its absolute value, round it, and then take its ceiling and floor.
c. Generate some random numbers.
d. Create a floating-point cv::Point2f and convert it to an integer cv::Point.Convert a cv::Point to a cv::Point2f.
*/

#include <opencv2/opencv.hpp>
#include <iostream>

int main(int argc, char** argv)
{
	// don't find this file
	// a
	float flt = -3.14142f;		
	// b
	float abs = cv::abs(flt);
	int round = cvRound(flt);
	int ceil = cvCeil(flt);
	int floor = cvFloor(flt);
	
	std::cout << "input: " << flt << std::endl
		<< "abs: " << abs << std::endl
		<< "round: " << round << std::endl
		<< "ceil: " << ceil << std::endl
		<< "floor: " << floor << std::endl;

	// c
	cv::RNG rng;
	int rand = rng;
	float randf = rng.operator float();
	double randd = rng.operator double();

	std::cout << "random:" << rand << "  " << randf << " " << randd <<  std::endl;

	// d
	cv::Point2f p1(10.1, 15);
	cv::Point p1_ = (cv::Point)p1;
	cv::Point2f p1f = (cv::Point2f)p1_;
	std::cout << "p1 = (" << p1.x << ", " << p1.y << ")" << std::endl << "p1_ = (" << p1_.x << ", " << p1_.y << ")" << std::endl
		<< "p1f = (" << p1f.x << ", " << p1f.y << ")" << std::endl;

	
	return 0;
}